package com.cssw.fyzb.busi.api.live;

import com.cssw.fyzb.busi.service.live.GiftService;
import com.cssw.fyzb.busi.service.live.LiveService;
import com.cssw.fyzb.core.model.dodb.CmfGift;
import com.cssw.fyzb.core.model.dodb.CmfLiveMute;
import com.cssw.fyzb.core.model.dodb.CmfLiveReport;
import com.ydn.appserver.Action;
import com.ydn.appserver.Request;
import com.ydn.appserver.Response;
import com.ydn.appserver.annotations.Function;
import com.ydn.appserver.annotations.Parameter;
import com.ydn.appserver.annotations.Type;
import com.ydn.dbframe.plugin.activerecord.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 获取举报列表
 * @author wondream
 */
@Function(description = "获取举报列表", parameters = {
        @Parameter(name = "liveId", type = Type.String, description = "用户标识", required = true),
        @Parameter(name = "pageNumber", type = Type.String, description = "当前页，从1开始", required = true),
        @Parameter(name = "pageSize", type = Type.String, description = "页大小", required = true)
})
@Component
public class ListLiveReport implements Action {

    @Autowired
    LiveService liveService;

    @Override
    public Response execute(Request request) throws Exception {
        Long liveId = request.getLong("liveId");
        Integer pageNumber = request.getInteger("pageNumber");
        Integer pageSize = request.getInteger("pageSize");
        Page<CmfLiveReport> page = liveService.listLiveReport(liveId, pageNumber, pageSize);
        return Response.success().put("list", page.getList()).put("total", page.getTotalPage()).put("count", page.getTotalRow());
    }
}


